package com.mjk.common.web.getway.utils.loadbalancer;

import com.mjk.common.web.getway.utils.loadbalancer.impl.*;

/**
 * 负载均衡类型
 */
public enum LoadBalanceType {
    /**
     * Hash
     */
    CONSISTENDHASH("hash", ConsistentHashLoadBalance.class),
    /**
     * 权重轮训
     */
    WEIGHTEDROUND("weightround", WeightedRoundRobinLoadBalance.class),
    /**
     * 权重随机
     */
    WEIGHTEDRANDOM("weightrandom", WeightedRandomLoadBalance.class),
    /**
     * 最小连接数
     */
    LEAST("least", LeastConnectionsLoadBalance.class),
    /**
     * 轮询
     */
    ROUND("round", RoundRobinLoadBalance.class),
    /**
     * 随机
     */
    RANDOM("random", RandomLoadBalance.class);
    private final String type;
    private final Class<? extends AbstractLoadBalancer> loadBalancer;

    LoadBalanceType(String type, Class<? extends AbstractLoadBalancer>  loadBalancer){
        this.type = type;
        this.loadBalancer = loadBalancer;
    }
}
